<?php
isset($step) ? true : $step = '';
$steps = array(
	array(
		'label' => 'ostukorv',
		'link' => $sf_request->getParameter('step',1) > 1 && $sf_request->getParameter('step',1) != 5 ? LinkGen::getInstance(LinkGen::STRUCTURE)->link($node['id'], array('step' => 1)) : '#',
		'active' => $sf_request->getParameter('step',1) == 1 && $step != 'register',
		'hidden' => false
	),
	array(
		'label' => 'sisse logimine',
		'link' => '#',
		'active' => $sf_request->getParameter('step',1) == 2 || $step == 'register',
		'hidden' => $sf_user->isAuthenticated()
	),
	array(
		'label' => 'maksja andmed', // only if payment step is >= 3
		'link' => $sf_request->getParameter('step',1) > 3 && $sf_request->getParameter('step',1) != 5 ? LinkGen::getInstance(LinkGen::STRUCTURE)->link($node['id'], array('step' => 3)) : '#',
		'active' => $sf_request->getParameter('step',1) == 3,
		'hidden' => false
	),
	array(
		'label' => 'tellimuse ülevaade', // only if payment step is >= 3
		'link' => $sf_request->getParameter('step',1) > 4 && $sf_request->getParameter('step',1) != 5 ? LinkGen::getInstance(LinkGen::STRUCTURE)->link($node['id'], array('step' => 4)) : '#',
		'active' => $sf_request->getParameter('step',1) == 4,
		'hidden' => false
	),
	array(
		'label' => 'valmis',
		'link' => '#',
		'active' => $sf_request->getParameter('step',1) == 5,
		'hidden' => false
	),
);
?>

<div class="ostukorv">
	<div class="korvmenu">
		<div class="korvmenuleft"><img src="/enermaatik/img/korvml.png" width="12" height="35" alt=""/></div>
		<div class="korvmenucenter">
			<?php foreach($steps as $step): ?>
			<?php if($step['hidden'])continue; ?>
			<div class="korvlink <?php echo $step['active'] ? 'active' : '' ?>">
				<div class="korvlinkleft korvbg <?php echo $step['active'] ? 'active' : '' ?>"></div>
				<div class="korvlinkcenter korvbg <?php echo $step['active'] ? 'active' : '' ?>">
					<p><a href="<?php echo $step['link'] ?>"><?php echo $step['label'] ?></a></p>
				</div>
				<div class="korvlinkright korvbg <?php echo $step['active'] ? 'activearrow' : '' ?>"></div>
			</div>
			<?php endforeach; ?>

		</div>
		<div class="korvmenuright"><img src="/enermaatik/img/korvmr.png" width="12" height="35" alt=""/></div>
		<div class="clear"></div>
	</div>
</div>

<script type="text/javascript">
$('.korvlink').mouseover(function(){
	$(this).find('.korvbg').addClass('active');
	$('.korvlink').mouseleave(function(){
		if(!$(this).hasClass('active')){
			$(this).find('.korvbg').removeClass('active');
		}
	});
});
</script>